<template>
  <el-table border :data="list" style="width: 100%; margin-top: 40px">
    <el-table-column property="id" label="序号" width="80" align="center" />
    <el-table-column
      property="fabumingcheng"
      label="发布名称"
      align="center"
    />
    <el-table-column property="leixing" label="类型" align="center" />
    <el-table-column property="xiangmumingcheng" label="招标项目" align="center" />
    <el-table-column property="chengshi" label="项目城市" align="center" />
    <el-table-column
      property="xiangmuleixing"
      label="招标项目类型"
      align="center"
    />
    <el-table-column
      property="createTime"
      label="发布时间"
      align="center"
    />
    <el-table-column label="状态" align="center">
      <template #default="scope">
        <span v-if="scope.row.shangjia">{{ scope.row.shangjia.code == 0 ? '下架' : '上架' }}</span>
      </template>
    </el-table-column>
    <el-table-column label="操作" width="80" align="center">
      <template #default="scope">
        <el-button
          style="min-width: auto"
          link
          type="primary"
          size="small"
          @click.prevent="onOperation(scope.row)"
          >详情</el-button
        >
      </template>
    </el-table-column>
  </el-table>
  <h-page
    v-if="total"
    v-model:curr-page="params.current"
    :size="params.size"
    :total="total"
    @change="GetList"
  />
</template>
<script setup>
import { ref, defineProps } from "vue";
import { GetProjectDeployInfo } from "@/api/user";
import { useRouter } from "vue-router";
const router = useRouter();
const props = defineProps({
  yhNo: {
    type: String,
    default: "",
  },
});
const params = ref({
  yhNo: props.yhNo,
  current: 1,
  size: 10,
});
// 用户
const list = ref([]);
const total = ref(0);
// 操作
const onOperation = (row) => {
  router.push({
    path: `/xiangmu/detail`,
    query: {
      id: row.xmId,
    },
  });
};
// 项目信息发布
const GetList = () => {
  GetProjectDeployInfo(params.value).then((res) => {
    if (res.code == 4201) {
      list.value = res.data.records;
      total.value = res.data.total;
    }
  });
};
GetList();
</script>
